<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
        <title><?php echo (L("_web_title_")); ?></title>
        <meta content="Admin Dashboard" name="description" />
        <meta content="Themesdesign" name="author" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />       
        <!-- App Icons -->     
        <link rel="shortcut icon" type="image/x-icon" href="/xnqb/Public/Home/images/favicon.ico">
        <!--Morris Chart CSS -->
        <link rel="stylesheet" href="/xnqb/Public/Home/css/morris.css">

        <!-- App css -->
        <link href="/xnqb/Public/Home/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!--  -->
        <link href="/xnqb/Public/Home/css/icons.css" rel="stylesheet" type="text/css" />
        <link href="/xnqb/Public/Home/css/style.css" rel="stylesheet" type="text/css" />
        <link href="/xnqb/Public/Home/flag-css/css/flag-icon.min.css" rel="stylesheet" type="text/css" />
        <style type="text/css">
            #topnav .navbar-custom {
                linear-gradient(to right, #043E73,#287BC7);
                box-shadow: 0 1px 1px rgba(0,0,0,.1);
                padding-left: 0;
            }

            .header-item h5 {
                color: hsl(51, 100%, 57%);
                font-size: 14px;
            }
            .my-container{
            	width:60%;
            }
            
            @media (max-width:991px) {

				.my-container {
					width:100%;
				}
			}
        </style>
    </head>


    <body>

        <!-- Begin page -->
        <div class="accountbg"></div>
        <div class="wrapper-page">

            <div class="card">
                <div class="card-body">

                  

                    <h4 class="text-muted text-center font-18"><b><?php echo (L("_get_account_password_back_")); ?></b></h4>

                    <div class="p-3">
                        <form id="login_form" class="form-horizontal m-t-20" method="post" action="" >

                            <div class="form-group row">
                                <div class="col-12">
                                    <input class="form-control" id="username" name="username" type="text" required="" data-parsley-minlength="6" 
                                    data-parsley-minlength-message="<?php echo (L("_reg_username_minlength_")); ?>" data-parsley-maxlength="20" 
                                    data-parsley-maxlength-message="<?php echo (L("_reg_username_maxlength_")); ?>" 
                                    data-parsley-required-message="<?php echo (L("_reg_username_")); ?> <?php echo (L("_required_")); ?>" 
                                    placeholder="<?php echo (L("_reg_input_placeholder_")); echo (L("_reg_username_")); ?>">
                                </div>
                            </div>


                            
                            <div class="form-group row" style="margin-bottom: 0;">
                                <div class="col-6">
                                    <input class="form-control" id="verif_code" placeholder="<?php echo (L("_reg_input_placeholder_")); ?> <?php echo (L("_reg_verification_code_")); ?>" name="verif_code" type="text" required="" 
                                                    data-parsley-minlength="4" 
                                                    data-parsley-minlength-message="<?php echo (L("_reg_verification_code_minlength_")); ?>" 
                                                    data-parsley-maxlength="4"
                                                    data-parsley-maxlength-message="<?php echo (L("_reg_verification_code_maxlength_")); ?>" 
                                                    data-parsley-required-message="<?php echo (L("_reg_verification_code_")); echo (L("_required_")); ?>" >
                                </div>
                                <div class="col-6">
                                    <img id="reload_verif_code_img" src="<?php echo U('Login/get_verif_code');?>" style="display: inline-block; width: 100%; height: 80%; cursor: pointer;"/>
                                </div>
                            </div>
                              
                          

                            <div class="form-group text-center row m-t-20">
                                <div class="col-12">
                                    <button class="btn btn-info btn-block waves-effect waves-light submit_btn" type="submit"><?php echo (L("_verify_now_")); ?></button>
                                </div>
                            </div>

                            <div class="form-group m-t-10 mb-0 row">
                                

                                <div class="col-sm-6 m-t-20">
                                    <div class="radio">
                                      <label>
                                        <input type="radio" name="l" id="optionsRadios1" value="en-us">
                                        <?php echo (L("_english_")); ?>
                                      </label>
                                    </div>
                                </div>
                                
                                <div class="col-sm-6 m-t-20">
                                    <div class="radio">
                                      <label>
                                        <input type="radio" name="l" id="optionsRadios2" value="zh-cn">
                                        <?php echo (L("_chinese_")); ?>
                                      </label>
                                    </div>
                                </div>


                            </div>
                        </form>
                    </div>

                </div>
            </div>
        </div> 
        
  
        <!-- jQuery  -->
        <script src="/xnqb/Public/Home/js/jquery.min.js"></script>
        <script src="/xnqb/Public/Home/js/popper.min.js"></script>
        <script src="/xnqb/Public/Home/js/bootstrap.min.js"></script>
        <script src="/xnqb/Public/Home/js/modernizr.min.js"></script>
        <script src="/xnqb/Public/Home/js/waves.js"></script>
        <script src="/xnqb/Public/Home/js/jquery.slimscroll.js"></script>
        <script src="/xnqb/Public/Home/js/jquery.nicescroll.js"></script>
        <script src="/xnqb/Public/Home/js/jquery.scrollTo.min.js"></script>
        
        <script src="/xnqb/Public/Home/layer/layer.js"></script>
        <!-- App js -->
        <script src="/xnqb/Public/Home/js/app.js"></script>
        <script type="text/javascript" src="/xnqb/Public/Home/js/parsleyjs/parsley.min.js"></script>
      <script type="text/javascript">
        $(function(){
        	// 刷新验证码
        	
        	var reload_verif_code_img_src = $('#reload_verif_code_img').attr('src');
        	var reload_verif_code = function () {
        		$('#reload_verif_code_img').attr('src', reload_verif_code_img_src + '?rand=' + parseInt(Math.random() * 10000000));
        	};
        	$('#reload_verif_code_img').click(function () {
        		reload_verif_code();
        	});
        	       	
            if('<?php echo ($lang); ?>' == 'en-us'){
                $('#optionsRadios1').attr("checked", "checked");
            } else {
                $('#optionsRadios2').attr("checked", "checked"); 
            }
            
            
            $(":radio").click(function(){               
                window.location.replace('<?php echo U('Login/forgot_password');?>'+'?l='+ $(this).val());
            });

            $('#login_form').parsley().on('form:submit', function() {
            	
            	var username = $("#username").val();             
                var verif_code = $('#verif_code').val();             
               	$.ajax({
               	    type: "POST",
               	    url: "<?php echo U('Login/forgot_password');?>",
               	    data: {
               	    	username : username,               	    	
               	    	verif_code : verif_code
               	    },// 要提交的表单
               	    dataType: 'json',
               	    beforeSend: function(){
       					layer_index = layer.load(1, {
       					  	shade: [0.1, '#ccc'] //0.1透明度的白色背景
       					});
       				},
               	    success: function (data, response) {
               	    	layer.close(layer_index);
               	    	if (data.flag > 0) {               	            
               	    		window.location="<?php echo U('Login/authentication');?>?account="+data.account+"&email="+data.email;
               	    	} 
               	    	$('#verif_code').val('');// 清空验证码
               	    	reload_verif_code(); 
               	    	layer.msg(data.msg);
               	    },
               	    error: function (error) {
               	    	layer.close(layer_index);
               	    	alert('error');
               	    }
               	  });
            	  
            	 return false;
            });          
          });
       </script>
    </body>
</html>